public class Solution1413 {
    public int minStartValue(int[] nums) {
        int a=0,min=0;
        for (int num : nums) {
            a+=num;
            min=Math.min(min,a);
        }
        return -min+1;
    }

    public static void main(String[] args) {
        System.out.println(new Solution1413().minStartValue(new int[]{-3,2,-3,4,2}));
    }
}
